package com.tony.blog.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**  
 * Created with IntelliJ IDEA.
 * @Title: SysUserEntity
 * @Auther: 皮蛋布丁
 * @Date: 2021/07/09/10:05
 * @Description: 系统用户
 */
@Data
@TableName("sys_user")
public class SysUserEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId
    private Long userId;

    @NotBlank(message="用户名不能为空")
    private String username;

    private String name;

    //@NotBlank(message="密码不能为空")
    private String password;

    private String salt;

    @NotBlank(message="邮箱不能为空!")
    private String email;

    //@NotBlank(message="手机号不能为空!")
    private String mobile;

    private Integer status;

    //身份类型：0-前端注册的普通用户；1-后端管理员
    private Integer type = 0;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    //@NotNull(message="部门Id不能为空!")
    private Long deptId;

    private String imgUrl;

    //@TableField：字段属性不为数据库表字段，但又是必须使用的
    @TableField(exist=false)
    private List<Long> roleIdList;

    @TableField(exist=false)
    private String deptName;

    @TableField(exist=false)
    private List<Long> postIdList;

    @TableField(exist=false)
    private String postName;
}